/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui.graphs3d;

import com.sun.j3d.utils.geometry.Box;
import javax.media.j3d.Appearance;
import javax.media.j3d.PolygonAttributes;
import javax.media.j3d.Shape3D;
import javax.media.j3d.TransparencyAttributes;


/**
 *
 * @author Elad
 */
public class TransperantBox extends Box {

    public TransperantBox(float width, float height, float depth) {
        super(width, height, depth, new Appearance());
        Appearance app = new Appearance();
// switch off face culling
      /*PolygonAttributes pa = new PolygonAttributes();
        pa.setCullFace(PolygonAttributes.CULL_FRONT);
        app.setPolygonAttributes(pa);*/
// semi-transparent appearance
        TransparencyAttributes ta = new TransparencyAttributes();
        ta.setTransparencyMode(TransparencyAttributes.BLENDED);
        ta.setTransparency(1.0f); // 1.0f is totally transparent
        app.setTransparencyAttributes(ta);
        setAppearance(app); //all sides will be transparent

        Shape3D bottom = getShape(Box.BOTTOM);
       // Shape3D top = getShape(Box.TOP);
        Shape3D back = getShape(Box.BACK);
  //      Shape3D front = getShape(Box.FRONT);
        Shape3D left = getShape(Box.LEFT);
      //  Shape3D right = getShape(Box.RIGHT);
        Appearance bottomApp = new Appearance();
        /*Color3f blue = new Color3f(new Color(167, 66, 91));//color of text
        Color3f black = new Color3f(0.0f, 0.0f, 0.0f);
        Color3f lightBlue = new Color3f(new Color(175, 238, 238));
        bottomApp.setMaterial(new Material(blue, black, blue, blue, 80.0f));*/
        PolygonAttributes pa = new PolygonAttributes();
        pa.setCullFace(PolygonAttributes.CULL_NONE); //color both sides of surface
        bottomApp.setPolygonAttributes(pa);
        TransparencyAttributes halfTransparent = new TransparencyAttributes();
        halfTransparent.setTransparencyMode(TransparencyAttributes.BLENDED);
        halfTransparent.setTransparency(0.9f); // 1.0f is totally transparent
        bottomApp.setTransparencyAttributes(halfTransparent);
        bottom.setAppearance(bottomApp);
        back.setAppearance(bottomApp);
        left.setAppearance(bottomApp);
    }
}
